<template>
  <div>
    <div class="user_detail">
      <div class="user_img">
        <img :src="userinfo.user_img" v-if="userinfo.user_img" alt="">
        <img src="@/assets/noface.jpg" v-else alt="">
      </div>
      <div class="user_edit">
        <div>
          <p>
            <span>0</span>
            <span class="user_text">粉丝</span>
          </p>
          <p>
            <span>0</span>
            <span class="user_text">关注</span>
          </p>
          <p>
            <span>0</span>
            <span class="user_text">获赞</span>
          </p>
        </div>
        <div class="edit_btn" @click="$router.push('/edit')">
          编辑资料
        </div>
      </div>
    </div>

    <div class="user_intro">
      <div class="title">
        <span>{{userinfo.name}}</span>
      </div>
      <p v-if="userinfo.user_desc">{{userinfo.user_desc}}</p>
      <p v-else>这个人很神秘，什么都没有写</p>
    </div>
  </div>
</template>

<script>
export default {
  props: ['userinfo']
}
</script>

<style lang="less" scoped>
.user_detail {
  background-color: white;
  padding: 0 3.333vw;
  display: flex;
  .user_img {
    margin-right: 12.5vw;
    img {
      width: 23.611vw;
      height: 23.611vw;
      border-radius: 50%;
    }
  }
  .user_edit {
    flex: 1;
    div:nth-child(1) {
      display: flex;
      padding: 2.222vw 2.778vw;
      p {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        position: relative;
        font-size: 3.611vw;
        .user_text {
          color: #aaa;
        }
      }
      p:nth-child(1):after, p:nth-child(2):after {
        content: '|';
        display: block;
        position: absolute;
        right: 0;
        color: #ccc;
      }
    }
    .edit_btn {
      width: 100%;
      height: 7.222vw;
      line-height: 7.222vw;
      text-align: center;
      color: #fb7a9f;
      border: 0.278vw solid #fb7a9f;
      border-radius: 0.833vw;
      font-size: 3.611vw;
    }
  }
}

.user_intro {
  background-color: white;
  padding: 10px 10px;
  .title {
    font-size: 4.8vw;
    color: #212121;
    max-width: 62.667vw;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
  }
  p {
    margin-top: 2.133vw;
    font-size: 3.467vw;
    color: #999;
    height: 4.533vw;
    line-height: 4.533vw;
    width: 83.467vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
</style>
